package exception;

public class ExceptionDemo {

	public static void main(String[] args) {
		
		
			try {
				int show = show(4,-4);
				System.out.println(show);
			} catch (FuShuException e) {
				System.out.println(e.toString());
				System.out.println("除数出现负数了,错误的负数是："+e.getValue());
			}
		
		System.out.println("程序照常执行。。。。。。。");
	}
	
	public static  int show(int a,int b) throws FuShuException{
		if(b < 0)
			throw new FuShuException("出现了除数为负数 by / fushu",b);
		return a/b;
	}
}

class FuShuException extends RuntimeException{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 7661896663449461737L;
	
	private int value;
	
	FuShuException(){
		super();
	}

	FuShuException(String msg,int value){
		super(msg);
		this.value = value;
	}
	
	public int getValue(){
		return value;
	}
}
